from pyecharts import Pie

a1 = ["男性", "女性"]
v1 = [459, 66]

a11 = ["已婚员工", "未婚员工"]
v11 = [336, 189]

a21 = ["男-已婚", "男-未婚"]
v21 = [285, 174]

a22 = ["女-已婚", "女-未婚"]
v22 = [51, 15]
pie = Pie('Pycharts饼图嵌套示例', '示例', title_pos='center', title_text_size=20, subtitle_color='#000', subtitle_text_size=16,
          height=500)

pie.add('', a1, v1, center=[50, 55], radius=[5, 20], is_random=True,
        is_label_show=True, label_text_size=13, label_pos='bottom',
        legend_pos='left', is_more_utils=True, rosetype='radius'
        , label_emphasis_pos='top', label_emphasis_textcolor='', label_emphasis_textsize=30
        )

pie.add('', a11, v11, center=[50, 55], radius=[25, 40],
        is_label_show=True, label_text_size=13, label_pos='top',
        legend_pos='left', rosetype='radius', label_emphasis_pos='top'
        , label_emphasis_textcolor='', label_emphasis_textsize=30
        )

pie.add('', a21, v21, center=[50, 55], radius=[45, 60], label_pos='right',
        is_label_show=True, label_text_size=13, legend_pos='left', rosetype='radius'
        , label_emphasis_pos='top', label_emphasis_textcolor='', label_emphasis_textsize=30)

pie.add('', a22, v22, center=[50, 55], radius=[65, 80], label_pos='left',
        is_label_show=True, label_text_size=13,
        legend_pos='left', legend_top='center', rosetype='radius', legend_orient="vertical"
        , label_emphasis_pos='top', label_emphasis_textcolor='', label_emphasis_textsize=30)

pie.render("./生成的图表/06.html")

# import os #在windows系统上使用以下两句
# os.startfile("./生成的图表/06.html")

import subprocess  # 在linux系统上使用以下两句。

subprocess.call(['xdg-open', './生成的图表/06.html'])